package cc.cix.hq.auth.controller;

import cc.cix.hq.common.core.exception.HqException;
import cc.cix.hq.common.validate.code.service.IValidateCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author cix
 */
@Api(tags = "登录管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/login")
public class LoginController {

    private final IValidateCodeService validateCodeService;

    @ApiOperation("图形验证码")
    @GetMapping("/captcha")
    public Map<String, String> captcha(HttpServletRequest request) throws HqException {
        return validateCodeService.create(request);
    }

}
